﻿namespace BW.IDAL
{
    public interface IbaseDAL<T> where T : class
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddRangeAsync(List<T> list);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateRangeAsync(List<T> list);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="t">数据对象</param>
        /// <returns>返回受影响行数</returns>
        Task<int> DeleteAsync(T t);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="list">数据对象集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> DeleteRangeAsync(List<T> list);
        /// <summary>
        /// 延迟执行[解决查的问题]
        /// </summary>
        /// <returns>返回IQueryable<T>对象</returns>
        IQueryable<T> GetAllAsync();
    }
}
